home *** CD-ROM | disk | FTP | other *** search
-
- ;Excel DDE Example
- ;This code makes a multiplication table in Excel via DDE
- ; Find Excel
- a=FileLocate("excel.exe") ; Try brute force path search
- if a=="" then a=IniRead("extensions","xls","") ; No? Try via [extensions] section
- terminate(a=="","Error","Excel not found") ; Not installed normally
- b=strindex(a," ",0,@FWDSCAN) ; Find first space
- if b==0 then b=strlen(a)+1 ; None? ...adjust b
- b=strsub(a,1,b-1) ; Pick off ^.xls stuff
- run(b,"") ; Run Excel
-
- channel = DDEInitiate("Excel", "Sheet1")
-
- Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
-
- offset=1
- row=0
-
- :rowloop
- col=0
- row=row+1
- if row > 10 then goto byebye
-
- ThisNum=ItemExtract(row,Numbers," ")
- title=row+offset
- DDEPoke(channel, "R1C%title%", ThisNum)
- DDEPoke(channel, "R%title%C1", ThisNUm)
-
- :colloop
- col=col+1
- if col > 10 then goto rowloop
-
- expression="=%row%*%col%"
- address=strcat("R",row+offset,"C",col+offset)
- DDEPoke(channel,address,expression)
- goto colloop
-
- :byebye
- DDETerminate(channel)
- Message("WinBatch DDE Sample","Complete")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-